const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void (async function () {
  let lines = await readline();
  let line;
  while ((line = await readline()) !== undefined) {
    let x = 1;
    let str = line.split("");
    for (let ch = 0; ch < str.length; ch++) {
      let i = ch + 1;
      if (i + x - 1 < str.length) {
        let c = str[i + x - 1];
        if (c >= "A" && c <= "Z") {
          str[i + x - 1] = c.toLowerCase();
          x = x + 1;
          let current = str[ch];
          if (current >= "a" && current <= "z") {
            str[ch] = current.toUpperCase();
          }
        }
      }
    }
    console.log(str.join(""));
  }
})();
